import 'package:flutter_reactive_value/flutter_reactive_value.dart';
import 'kite_heritage_entity.dart';

/// 风筝文化控制器
class KiteHeritageController {
  static final KiteHeritageController _instance = KiteHeritageController._();
  static KiteHeritageController get globalInstance => _instance;

  KiteHeritageController._();

  /// 当前选中的风筝文化数据
  final ReactiveValueNotifier<KiteHeritageEntity?> _currentHeritage =
      ReactiveValueNotifier<KiteHeritageEntity?>(null);

  ReactiveValueNotifier<KiteHeritageEntity?> get currentHeritageState =>
      _currentHeritage;

  /// 根据ID查询风筝文化数据
  void selectHeritageById(String id) {
    final heritage = KiteHeritageEntity.findHeritageByIdentifier(id);
    _currentHeritage.value = heritage;
  }
}
